package test.dhcp;

import java.util.logging.Level;
import java.util.logging.Logger;

import top.ieei.demo.dhcp.DHCPCoreServer;
import top.ieei.demo.dhcp.DHCPPacket;
import top.ieei.demo.dhcp.DHCPServerInitException;
import top.ieei.demo.dhcp.DHCPServlet;

public class DHCPSnifferServlet extends DHCPServlet
{
  private static final Logger logger = Logger.getLogger(DHCPSnifferServlet.class.getName());

  public DHCPPacket service(DHCPPacket request)
  {
    logger.info(request.toString());
    return null;
  }

  public static void main(String[] args)
  {
    try
    {
      DHCPCoreServer server = DHCPCoreServer.initServer(new DHCPSnifferServlet(), null);
      new Thread(server).start();
    } catch (DHCPServerInitException e) {
      logger.log(Level.SEVERE, "Server init", e);
      e.printStackTrace();
    }
  }
}